Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: add pry and update testing instructions #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

klondikemarlen
Copy link

Add pry and helpers to gem source when developing.

To test run:

bundle install
bundle exec pry

Once in pry

# config info can be found at https://github.com/proofgov/proofgov/blob/master/customer/dev/sharepoint_servers/2013.yml

require 'sharepoint-ruby'
require 'sharepoint-http-auth'

def encode_path(path, safe_quote: true)
  path = Addressable::URI.encode(path)
  path.gsub!(/'/, '%27%27') if safe_quote
  path.gsub!('+', '%2B')
  path
end

domain = '<domain>' # from config
site_path = '<site_path>' # from config
sharepoint_library_name = encode_path('<sharepoint_library_name>') # from config
folder_name = '<some-folder-name>'
site = Sharepoint::Site.new domain, site_path

site.session = Sharepoint::HttpAuth::Session.new(site)
site.session.authenticate('<username>', ENV.fetch('SRVPROOFTEST_PASSWORD'))

folder = site.query(:get, "GetFolderByServerRelativeUrl('/#{site_path}/#{sharepoint_library_name}/#{folder_name}')")
file = site.query(:get, "GetFileByServerRelativeUrl('/#{site_path}/#{sharepoint_library_name}/#{folder_name}/test.docx')")
version = site.query(:get, "GetFileByServerRelativeUrl('/#{site_path}/#{sharepoint_library_name}/#{folder_name}/test.docx')/Versions(512)")

@klondikemarlen klondikemarlen added the enhancement New feature or request label Oct 6, 2021
@klondikemarlen klondikemarlen self-assigned this Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant